package com.ys.web.pay;

import lombok.AllArgsConstructor;

public interface PayEnum {
    final static String NUKNOW = "未知枚举";
    //识别认证的支付方式
    @AllArgsConstructor
    public enum payMentType {
        ALIPAY("4", "支付宝"), WECHAT("2", "微信"), CHANGE("3", "零钱"),
        BANK("1", "银行卡"), NUKNOW_PAYMENTTYPE("NUKNOW","NUKNOW");
        public String code;
        public String name;
        public static String getNameByCode(String key) {
            for (payMentType object : payMentType.values()) {
                if (object.getCode().equals(key)) {
                    return object.getName();
                }
            }
            return NUKNOW;
        }
        public static payMentType getEnumByCode(String key) {
            for (payMentType object : payMentType.values()) {
                if (object.getCode().equals(key)) {
                    return object;
                }
            }
            return NUKNOW_PAYMENTTYPE;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }

    /** -----------------------------红包start----------------------------------**/
    // 红包类型
    public enum RedPackageType {
        Single("1", "私聊红包"), GroupLuck("2", "手气红包"),
        GroupNormal("3", "普通红包"), GroupPersonal("4", "专属红包");
        public String code;
        public String name;

        RedPackageType(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static RedPackageType getObjectByCode(String key) {
            for (RedPackageType object : RedPackageType.values()) {
                if (object.getCode().equals(key)) {
                    return object;
                }
            }
            return null;
        }
    }

    // 红包状态
    public enum RedPackageStatus {
        NoPay("0", "未支付"),Processing("1", "进行中"),
        Complete("2", "已完成"), Expire("3", "已退款");
        public String code;
        public String name;

        RedPackageStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static RedPackageStatus getObjectByCode(String key) {
            for (RedPackageStatus object : RedPackageStatus.values()) {
                if (object.getCode().equals(key)) {
                    return object;
                }
            }
            return null;
        }

        public static String getDescByCode(String code) {
            for (PayEnum.RedPackageStatus value : PayEnum.RedPackageStatus.values()) {
                if (value.code.equals(code)) {
                    return value.name;
                }
            }
            return "";
        }

        public static String getShowType(String code){
            if(code.equals("1")){
                return "1";
            }else {
                return "2";
            }
        }

        public static boolean showHis(String code){
            if(code.equals("1")){
                return true;
            }else {
                return false;
            }
        }
    }

    // 提现状态
    public enum TransferStatus {

        APPLY_FAIL("1", "申请失败"), APPLY_SUCCESS("2", "申请成功"),
        TRANSFER_SUCCESS("3", "转账成功"),TRANSFER_FAIL("4", "转账失败");

        public String code;
        public String name;

        TransferStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getDescByCode(String code) {
            for (PayEnum.TransferStatus value : PayEnum.TransferStatus.values()) {
                if (value.code.equals(code)) {
                    return value.name;
                }
            }
            return "";
        }
    }
    /** -----------------------------红包end----------------------------------**/

    // 提现状态
    public enum WithdrawStatus {

        APPLY_WITHDRAWAL("1", "提现中"), WITHDRAWAL_SUCCESS("2", "提现成功"),
        WITHDRAWAL_FAIL("3", "提现失败"),WITHDRAWAL_WAIT("4", "提现审核"),
        WITHDRAWAL_EXC("5", "提现异常"),WITHDRAWAL_HANDLE("6", "提现处理中");

        public String code;
        public String name;

        WithdrawStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }
    // 提现审核状态
    public enum WithdrawWaitStatus {

        APPLY_WITHDRAWAL("1", "待审核"), WITHDRAWAL_SUCCESS("2", "通过"),
        WITHDRAWAL_FAIL("3", "冻结");

        public String code;
        public String name;

        WithdrawWaitStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    // 订单支付状态
    public enum PayStatus {
        NO_PAY("0", "未支付"), PAID("1", "已支付"), FAIL("2", "支付失败"), APP_PAY_FAIL("3", "申请支付失败"),REFUND("5","退单");
        public String code;
        public String name;

        PayStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getNameByCode(String key) {
            for (PayStatus object : PayStatus.values()) {
                if (object.getCode().equals(key)) {
                    return object.getName();
                }
            }
            return NUKNOW;
        }
    }

    // 动账类型 1-收益，2-申请提现，3-提现成功
    public enum AccountFlowType {
        INCOME("1", "月结发钱"), APPLY_FOR_WITHDRAWAL("2", "提现申请"), WITHDRAWAL_SUCCESS("3", "提现成功"),
        WITHDRAWAL_UNDO("4", "提现撤销"), UNKNOWN("KNOW", "未知"), APPLY_FAIL_WITHDRAWAL("5", "申请提现未通过"),
        PLAT_WITHDRAWAL_SUCCESS("6", "提现成功平台同步扣款"), TYPE_RECHARGE("7", "充值"), TYPE_RED_SEND("8", "发红包"),
        TYPE_RED_RECV("9", "收红包"), TYPE_RED_EXPR("10", "红包退回"), WITHDRAWAL_FAIL("11", "提现失败"),
        COUPON_BUY("12", "购买优惠券"), TYPE_TRANSFER_SEND("13", "发转账"),
        TYPE_TRANSFER_RECV("14", "收转账"), TYPE_TRANSFER_EXPR("15", "转账退回"), POPULARIZE("16","收益提现"),
        PAY_ORDER_MONEY_REFUND("17","商品支付退款"), PAY_ORDER_MONEY_FREE("18","提现手续费")
        , PAY_ORDER("19","商品支付扣款"),PAY_ORDER_MONEY("20","商品支付收款");
        public String code;
        public String name;

        AccountFlowType(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getNameByCode(String key) {
            for (AccountFlowType object : AccountFlowType.values()) {
                if (object.getCode().equals(key)) {
                    return object.getName();
                }
            }
            return NUKNOW;
        }
    }

    // 珍珠明细方式 1-收入，2-支出
    public enum projectFlowStyle {
        INCOME("1", "收入"), DISBURSE("2", "支出");
        public String code;
        public String name;

        projectFlowStyle(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getNameByCode(String key) {
            for (projectFlowStyle object : projectFlowStyle.values()) {
                if (object.getCode().equals(key)) {
                    return object.getName();
                }
            }
            return NUKNOW;
        }
    }
    
    
}
